package com.example.async_dmoe1.controller;

import com.example.async_dmoe1.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: 杨通通
 * @Date: 2024/9/20 00:02
 * @Description:
 */

@RestController
@RequestMapping("/hello")
public class HelloController {

    @Autowired
    private HelloService helloService;

    @GetMapping("/hello1")
    public String hello1(){
        System.out.println(Thread.currentThread().getName());
        helloService.asyncTask();//执行异步任务
        return helloService.hello1();
    }
}